#include<iostream>
#include<vector>
#include<unordered_map>
using namespace std;

int longestSubsequence(vector<int>& arr, int difference) {
    unordered_map<int, int> hash;
    hash[arr[0]] = 1;
    int ret = 1;
    for (int i = 1; i < arr.size(); i++)
    {
        hash[arr[i]] = hash[arr[i] - difference] + 1;
        ret = max(hash[arr[i]], ret);
    }
    return ret;
}
int lenLongestFibSubseq(vector<int>& arr) {
    int n = arr.size();
    int ret = 0;
    vector<vector<int>> dp(n, vector<int>(n));
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            dp[i][j] = 2;
    unordered_map<int, int> hash;
    for (int i = 0; i < n; i++)
        hash[arr[i]] = i + 1;
    for (int i = 1; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (hash.count(arr[j] - arr[i]) && arr[j] - arr[i] < arr[i])
                dp[i][j] = dp[hash[arr[j] - arr[i]] - 1][i] + 1;
            ret = max(ret, dp[i][j]);
        }
    }
    return ret < 3 ? 0 : ret;
}

int main()
{
    vector<int> v{ 1,3,7,11,12,14,18 };
    longestSubsequence(v, 1);
    unordered_map<int, int> mp;
    lenLongestFibSubseq(v);
    mp[1] = 1;
    if (mp[1] != 0)
        cout << mp[1];
    if (mp[2] != 0)
        cout << mp[2];
    //cout << mp[2];
    if (mp[2] != 0)
        cout << mp[2];
	return 0;
}